package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Notice;
import com.example.Laboratory.Mapper.NoticeMapper;
import com.example.Laboratory.Service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class NoticeServiceImpl implements NoticeService {
    @Autowired
    NoticeMapper noticeMapper;

    //增加公告信息
    @Override
    public String addNotice(Notice t) {
        if (noticeMapper.addNotice(t) == 1) {
            return "添加成功";
        } else {
            return "添加失败";
        }
    }

    //删除通知公告
    @Override
    public String deleteNotice(int notice_id) {
        if (noticeMapper.deleteNotice(notice_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }

    //修改通知公告
    @Override
    public String reviseNotice(Notice t) {
        if (noticeMapper.reviseNotice(t) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }

    //单条查找通知公告
    @Override
    public List<Notice> researchNotice1(int notice_id) {
        return noticeMapper.researchNotice1(notice_id);
    }


    //多条查找通知公告
    @Override
    public List<Notice> researchNotice2() {
        return noticeMapper.researchNotice2();
    }

}
